extends Node
class_name PlayerState

signal state_transition_requested(new_state: Player.State, state_data: PlayerStateData)

var ai_behavior : AIBehavior = null
var animation_player : AnimationPlayer = null
var teammate_detection : Area2D = null
var ball_detection_area : Area2D = null
var tackle_damage_emitter_area : Area2D = null
var opponent_detection_area : Area2D = null
var player : Player = null
var ball: Ball = null
var state_data: PlayerStateData = PlayerStateData.new()
var own_goal : Goal = null
var target_goal : Goal = null

func setup(	context_palyer: Player,
			context_state_data: PlayerStateData,
			context_animation_player: AnimationPlayer,
			context_teammate_detection: Area2D,
			context_ball_detection_area: Area2D,
			context_tackle_damage_emitter_area: Area2D,
			context_opponent_detection_area: Area2D,
			context_ball: Ball,
			context_own_goal: Goal,
			context_target_goal: Goal,
			context_ai_behavior: AIBehavior,
			) -> void:
	player = context_palyer
	state_data = context_state_data
	animation_player = context_animation_player
	teammate_detection = context_teammate_detection
	ball_detection_area = context_ball_detection_area
	tackle_damage_emitter_area = context_tackle_damage_emitter_area
	opponent_detection_area = context_opponent_detection_area
	ball = context_ball
	own_goal = context_own_goal
	target_goal = context_target_goal
	ai_behavior = context_ai_behavior

func transition_state(new_state: Player.State, context_state_data: PlayerStateData = PlayerStateData.new()) -> void:
	state_transition_requested.emit(new_state, context_state_data)

func on_animation_complete() -> void:
	pass

func can_carry_ball() -> bool:
	return false

func can_pass() -> bool:
	return false
